package com.ag.hmk.service.impl;
/**
 * @author 黄木看
 * 法规关键字服务接口实现
 */
import java.util.List;

import com.ag.bean.TbLkw;
import com.ag.common.IDUtil;
import com.ag.hmk.dao.HmkLawkwDAO;
import com.ag.hmk.service.LawkwService;

public class LawkwServImpl implements LawkwService {

	private HmkLawkwDAO hmkLawkwDAO;
	
	/*
	 * 删除一条记录（by id）
	 */
	public void delete(String lkwID) {
		if (lkwID!=null) {
			TbLkw tbLkw = hmkLawkwDAO.findById(lkwID);
			if (tbLkw!=null) {
				tbLkw.setA(IDUtil.DELETE);
				hmkLawkwDAO.attachDirty(tbLkw);
			}
		}
	}

	/*
	 * 查询所有记录
	 */
	public List<TbLkw> findAll() {
		return hmkLawkwDAO.findAll();
	}

	/*
	 * 查询一条记录(by id)
	 */
	public TbLkw findByID(String lkwID) {
		if (lkwID!=null) {
			return hmkLawkwDAO.findById(lkwID);
		} else {
			return null;
		}
		
	}

	/*
	 * 新增或更新记录
	 */
	public void save(TbLkw tbLkw) {
		if (tbLkw!=null) {
			tbLkw.setA(IDUtil.PRESERVE);
			hmkLawkwDAO.attachDirty(tbLkw);
		}
		
	}

	public void setHmkLawkwDAO(HmkLawkwDAO hmkLawkwDAO) {
		this.hmkLawkwDAO = hmkLawkwDAO;
	}

	

}
